package collection;

import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;

public class SetDemo1 {
    public static void main(String[] args) {
        //Set<Point> set = new LinkedHashSet<>();
        Set<Point> set = new HashSet<>();
        set.add(new Point(1,2));
        set.add(new Point(3,2));
        set.add(new Point(1,4));
        set.add(new Point(5,2));
        boolean b = set.add(new Point(1,2));//是否重复是由equals和hashcode一起决定
        System.out.println(b);
        System.out.println(set);//[(3,2), (1,2), (1,4), (5,2)]
                                //[(1,2), (3,2), (1,4), (5,2)]


    }
}
